<template>
	<view class="container">
		<view class="grade-header">
			<view class="grade-header_title text_black">批改训练计划的年级</view>
			<view class="grade-header_tips text_black">以下是您批改训练计划的年级</view>
		</view>
		<view class="grade-content" v-for="(item,index) in list" :key="index">
			<view class="grade-content_stage">{{item.section_name}}</view>
			<view class="grade-content_grade">
				<view class="grade-content_grade_item" 
				v-for="(citem,cindex) in item.grades" :key="cindex" @click="selectClass(item,citem)">
					{{citem.grade_name}}
					<image src="../../../static/imgs/mine/right.png"></image>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {getSchoolSection} from "../../../static/js/api/training.js";
	export default{
		data(){
			return{
				list:[],
			}
		},
		onLoad(option) {
			if(option.schooldId){
				this.getList(option.schooldId)
			}
		},
		methods:{
			getList(){
				getSchoolSection({
					school_id:1,//schooldId;测试用1
					grade:1
				}).then(res=>{
					this.list = res
					console.log(res)
				})
			},
			selectClass(parent,item){
				let info = {
					id:item.id,
					grade_name:item.grade_name,
					section_name:parent.section_name,
					section_id:item.section_id
				}
				uni.navigateTo({
					url:"/pages/releasePlan/staminaTest/class?grade="+JSON.stringify(info)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import url("./index.scss");
	
</style>